﻿@namespace MudBlazor
@using MudBlazor.Resources
@inherits MudComponentBase
@inject InternalMudLocalizer Localizer

@{
#nullable enable
}

<div @attributes="UserAttributes" id="@_elementId" class="mud-dialog-container @Position">
    <MudOverlay Visible="true" OnClick="HandleBackgroundClickAsync" Class="@BackgroundClassname" DarkBackground="true" />
    <div id="_@Id.ToString("N")" role="dialog" class="@Classname" style="@Style">
        @if (!NoHeader)
        {
            <div class="@TitleClassname">
                @if (TitleContent == null)
                {
                    <MudText Typo="Typo.h6">@Title</MudText>
                }
                else
                {
                    @TitleContent
                }
                @if (CloseButton)
                {
                    <MudIconButton aria-label="@Localizer[LanguageResource.MudDialog_Close]" Icon="@CloseIcon" @onclick="Cancel" class="mud-button-close" />
                }
            </div>
         }
        <CascadingValue Value="this" IsFixed="true">
            @Content
        </CascadingValue>
    </div>
</div>
